// 默认图片路径
const defaultImage = '/src/assets/images/default.jpg'

// 图片加载函数
export const loadImage = (src) => {
  return new Promise((resolve, reject) => {
    const img = new Image()
    img.onload = () => resolve(src)
    img.onerror = () => resolve(defaultImage)
    img.src = src
  })
}

// 图片错误处理函数
export const handleImageError = (e) => {
  e.target.src = defaultImage
} 